home *** CD-ROM | disk | FTP | other *** search
- ; This sample shows how
- ; to use SCASB instruction
- ; to find a symbol.
-
- #make_COM#
-
- ; COM file is loaded at 100h
- ; prefix:
- ORG 100h
-
- ; set forward direction:
- CLD
-
- ; set counter to string size:
- MOV CX, 10
-
- ; load string address
- ; into ES:DI
- MOV AX, CS
- MOV ES, AX
- LEA DI, str1
-
- ; we will look for the 'C'
- ; character in string:
- MOV AL, 'C'
-
- REPNE SCASB
-
- JZ found
-
- not_found:
-
- ; "No" - not found!
- MOV AL, 'N'
- MOV AH, 0Eh
- INT 10h
-
- JMP exit_here
- found:
-
- ; "Yes" - found!
- MOV AL, 'Y'
- MOV AH, 0Eh
- INT 10h
-
- ; DI contains the
- ; offset of 'C' character:
- DEC DI
-
- exit_here:
- RET
-
- str1 DB 'AAABBBCDDD'
-
-
- END
-